package com.jsu.springboot_crop.controller;

import com.fasterxml.jackson.annotation.JsonGetter;
import com.jsu.springboot_crop.common.Result;
import com.jsu.springboot_crop.common.StatusCode;
import com.jsu.springboot_crop.entity.BankUser;
import com.jsu.springboot_crop.service.BankUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author js
 * @name BankUserController
 * @Date 2023/8/26 15:40
 */
@RestController
@RequestMapping("/user")
public class BankUserController {
/*    @Autowired
    BankUserService bankUserService;
    //根据用户名查询用户
    @GetMapping("/search/{userName}")
    public Result<BankUser> selectByUserName(@PathVariable("userName")String userName){
        BankUser bankUser = bankUserService.selectByPrimaryKey(userName, null);
        return new Result<BankUser>(true, StatusCode.OK,"根据用户名查询用户成功",bankUser);
    }

    //根据应户名修改个人信息
    @PutMapping("/loginUpdateByUsername/{userName}")
    public Result loginUpdateByUsername(@PathVariable("userName")String  userName,@RequestBody BankUser bankUser){
        bankUser.setUserName(userName);
        bankUserService.updateByPrimaryKeySelective(bankUser);
        return new Result(true, StatusCode.OK,"根据用户名修改用户成功","修改");
    }

    //根据用户名修改密码
    @PutMapping("/loginUpdatePassword/{userName}")
    public Result loginUpdatePassword(@PathVariable("userName")String  userName,@RequestBody BankUser bankUser){
        bankUser.setUserName(userName);
        bankUserService.updateByPrimaryKeySelective(bankUser);
        return new Result(true, StatusCode.OK,"根据用户名修改密码成功","修改");
    }*/
}
